package org.example.struct.array;

/**
 * @author liyishan
 * @date 2024/4/12 10:09
 * @apiNote
 */

public class Test02923FindChampion {
    public static void main(String[] args) {
        int[][] grid = new int[][]{{0,0,1},{1,0,1},{0,0,0}};
        System.out.println(findChampion(grid));
    }

    public static int findChampion(int[][] grid) {
        int n = grid.length;
        int max = 0;
        int prev = 0;
        for (int i = 0; i < n; i++) {
            int sum = 0;
            for (int j = 0; j < n; j++) {
                if(grid[i][j] == 1){
                    sum += grid[i][j];
                }
            }
            if(sum > max) {
                max = sum;
                prev = i;
            }
        }
        return prev;
    }


}
